<template>
  <div>
    
   <table>
      <th>
      欢迎来到水果店
      </th>
      <tr>
        <td>苹果10￥/斤,折扣8折</td>
      </tr>
      <tr>
        输入你要购买的斤数 <input type="text"  v-model.number="num">
      </tr>
      <tr> <button @click="btnFn">结账买单</button></tr>
      <tr>结账单:总价{{money}}￥元 折后价:{{later}}￥元 省了:{{save}}￥元</tr>
    </table> 
    
  </div>
</template>

<script>
export default {
      data() {
        return {
          num:'0',
          money:'0',
          later:'0',
          save:'0'
        }
      },
      methods :{
          btnFn() {
            this.money =this.num*10
            this.later=this.money*0.8
            this.save = this.money-this.later
          }
      }
}
</script>

<style>

</style>